import request from '@/utils/request'
const module = '/admin/product/categoryBrand'

export const getCategoryBrands = (searchObj,pageNum, pageSize) => {
    return request({
      url: `${module}/list/${pageNum}/${pageSize}`,
      method: 'get',
      params:searchObj
    })
  }

  export const saveCategoryBrand = categoryBrand => {
    return request({
      url: `${module}/save`,
      method: 'post',
      data: categoryBrand,
    })
  }
  export const deleteCategoryBrandById = id => {
    return request({
      url: `${module}/deleteById/${id}`,
      method: 'delete',
    })
  }
  export const updateCategoryBrand = (categoryBrand) => {
    return request({
      url: `${module}/update`,
      method: 'put',
      data:categoryBrand
    })
  }
  export const getCategoryBrandById = id => {
    return request({
      url: `${module}/getById/${id}`,
      method: 'get',
    })
  }

  export const getBrandsByCategoryId = (categoryId) => {
    return request({
        url: `${module}/listBrands/${categoryId}`,
        method: 'get'
    })
}
